<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"></script>
</head>

<body>
  <div id="app">
    <button @click="isSaving = !isSaving">切换保存和编辑按钮</button>
    <transition>
      <a href="#" name="fade">
        <button v-if="isSaving" key="save">Save</button>
        <button v-else key="edit">Edit</button>
      </a>
    </transition>
  </div>

  <script>
    var vm = new Vue({
      el: "#app",
      data: {
        isSaving: true, // isSaving为true，显示保存按钮，为false显示编辑按钮
      }
    })
  </script>
</body>

</html>